<form id="addOrUpdateForm" lay-filter="addOrUpdateForm" class="layui-form model-form">

    <input name="id" type="hidden"/>
    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">预案名称</label>
        <div class="layui-input-block">
            <input name="name" class="layui-input" placeholder="请输入预案名称" lay-verType="tips" lay-verify="required" required/>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">处置事故组织</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入处置事故组织" class="layui-textarea" name="organization" lay-verify="required" required></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">报警程序</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入报警程序" class="layui-textarea" name="alarmprogram" lay-verify="required" required></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">组织实施</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入组织实施" class="layui-textarea" name="implement" lay-verify="required" required></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">扑救方法</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入扑救方法" class="layui-textarea" name="deal" lay-verify="required" required></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label layui-form-required">注意事项</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入注意事项" class="layui-textarea" name="notice" lay-verify="required" required></textarea>
        </div>
    </div>


</form>

<script>
    layui.use(['layer', 'form', 'admin', 'xnUtil', 'xmSelect', 'laydate'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var admin = layui.admin;
        var xnUtil = layui.xnUtil;
        var xmSelect = layui.xmSelect;
        var laydate = layui.laydate;


        var editData = admin.getLayerData('#addOrUpdateForm').data;
        if(editData !== null && editData !== undefined) {
            form.val('addOrUpdateForm', editData);
        }

        /**
         * 表单提交事件
         */
        form.on('submit(formSubmitBtn)', function (data) {
            layer.load(2);

            var url = editData ? getProjectUrl() + 'plan/edit' : getProjectUrl() + 'plan/add';
            admin.req(url, JSON.stringify(data.field), function(res){
                layer.msg(res.message, {icon: 1, time: 1000}, function () {
                    admin.putLayerData('formOk', true, '#addOrUpdateForm');
                    admin.closeDialog('#addOrUpdateForm');
                });
            }, 'post');
            return false;
        });
    });
</script>
</body>
</html>
